package com.muyu.cloud.commodity.domain.model;

import com.muyu.cloud.commodity.domain.req.ProductSkuUpdateReq;
import lombok.Builder;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author <a href="mailto:602048165@qq.com">60204</a>
 * @version 1.0
 * @description:
 * @date 2025/9/16 10:52
 */
@Data
@Builder
public class ProductSkuUpdateModel {
    private Long id;
    private String skuCode;
    private BigDecimal salePrice;
    private BigDecimal costPrice;
    private Integer stock;
    private String image;
    private Integer status;
    private List<Long> specValueIds;
    private Boolean isNew;

    public static ProductSkuUpdateModel buildModel(ProductSkuUpdateReq req) {
        ProductSkuUpdateModel model = new ProductSkuUpdateModel(builder().id, builder().skuCode, builder().salePrice,builder().costPrice, builder().stock, builder().image, builder().status, builder().specValueIds,builder().isNew);
        model.setId(req.getId());
        model.setSkuCode(req.getSkuCode());
        model.setSalePrice(req.getSalePride());
        model.setCostPrice(req.getCostPrice());
        model.setStock(req.getStock());
        model.setImage(req.getImage());
        model.setStatus(req.getStatus());
        model.setSpecValueIds(req.getSpecValueIds());
        model.setIsNew(req.getIsNew());
        return model;
    }
}
